/**
 * 
 */
package com.sesame.daoimpl;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.sesame.dao.AlbumDAO;
import com.sesame.domain.Album;

/**
 * @author voidman
 * 
 */
public class AlbumDAOImpl extends SqlMapClientDaoSupport implements AlbumDAO {

    public void addAlbum(Album Album) {
        getSqlMapClientTemplate().insert("addAlbum", Album);
    }

    public void deleteAlbumById(Integer id) {
        getSqlMapClientTemplate().delete("deleteAlbumById", id);
    }

    @SuppressWarnings("unchecked")
    public List<Album> getAllAlbum() {
        List<Album> listAlbum;
        listAlbum = getSqlMapClientTemplate().queryForList("getAllAlbum");
        return listAlbum;
    }
    
    public Album getAlbumById(Integer id) {

        return (Album) getSqlMapClientTemplate().queryForObject("getAlbumById", id);
    }

    public void updateAlbum(Album Album) {
        getSqlMapClientTemplate().update("updateAlbum", Album);
    }

}
